package com.baidu.videoseries.util;

import android.support.v4.app.Fragment;

import com.baidu.videoseries.fragment.AudioFragment;
import com.baidu.videoseries.fragment.MainFragment;
import com.baidu.videoseries.fragment.MediaPlayerFragment;
import com.baidu.videoseries.fragment.PlayDetailFragment;
import com.baidu.videoseries.fragment.SysPlayerFragment;
import com.baidu.videoseries.fragment.TestFragment;
import com.baidu.videoseries.fragment.VideoViewFragment;
import com.baidu.videoseries.fragment.VlcFragment;

/**
 * Created by leiyun on 2018/5/18.
 */
public class PageUtil {


    public static final class Index {
        public static final int AUDIO = 0;
        public static final int MEDIA_PLAYER = 1;
        public static final int PLAY_DETAIL = 2;
        public static final int SYS_PLAYER = 3;
        public static final int TEST = 4;
        public static final int VIDEO_VIEW = 5;
        public static final int VLC = 6;
        public static final int MAIN = 7;
    }

    /**
     * fragment factory
     * @param index
     * @return
     */
    public static Fragment getFragment(int index) {
        Fragment f = null;

        switch (index) {
            case Index.AUDIO:
                f = new AudioFragment();
                break;
            case Index.MAIN:
                f = new MainFragment();
                break;
            case Index.MEDIA_PLAYER:
                f = new MediaPlayerFragment();
                break;
            case Index.PLAY_DETAIL:
                f = new PlayDetailFragment();
                break;
            case Index.SYS_PLAYER:
                f = new SysPlayerFragment();
                break;
            case Index.TEST:
                f = new TestFragment();
                break;
            case Index.VIDEO_VIEW:
                f = new VideoViewFragment();
                break;
            case Index.VLC:
                f = new VlcFragment();
                break;
        }
        return f;
    }
}
